//
//  DarkModeDemo.swift
//  SwiftUIDemo
//
//  Created by Tilt Wang on 2025/7/2.
//

import SwiftUI

struct DarkModeDemo: View {
    
    @Environment(\.colorScheme) var colorScheme
    
    var body: some View {
        NavigationView {
            ScrollView {
                VStack(spacing: 20) {
                    Text("This color is primary")
                        .foregroundColor(.primary)
                    Text("This color is secondary")
                        .foregroundColor(.secondary)
                    Text("This color is black")
                        .foregroundColor(.black)
                    Text("This color is white")
                        .foregroundColor(.white)
                    Text("This color is red")
                        .foregroundColor(.red)
                    Text("This color is globally adaptive")
                        .foregroundColor(Color("AdaptColor"))
                    Text("This color is globally adaptive")
                        .foregroundColor(colorScheme == .light ? .green : .yellow)
                }
            }
            .navigationTitle("Dark Mode Demo")
        }
    }
}

#Preview {
    DarkModeDemo()
        .preferredColorScheme(.light)
}
